package Array.RemoveDuplicates;

import java.util.Arrays;

public class RemoveDuplicates {
    public int removeDuplicates(int[] nums) {
        int flag = 0;
        for (int i = 1; i < nums.length; i++) {
            if (nums[i] != nums[flag]) {
                flag++;
                nums[flag] = nums[i];
            }
        }
        return flag + 1;
    }
}
